home *** CD-ROM | disk | FTP | other *** search
- property pLastFrameTime, pBeginFrame, pCurrTimer, pCameraOverlay
- global gCamera, gCar, gWorld, gRacers, gSparkLocs, gTransFormat, gSolidFormat, gSpriteScale
-
- on beginSprite me
- pLastFrameTime = the milliSeconds
- pCurrTimer = -1
- gCar = gWorld.model("carModel_1")
- end
-
- on exitFrame
- if voidp(pBeginFrame) then
- pBeginFrame = the milliSeconds
- end if
- totalTime = the milliSeconds - pBeginFrame
- checkForExit()
- if totalTime < 1000 then
- if pCurrTimer <> 3 then
- showTimer(3)
- pCurrTimer = 3
- sound(2).play(member("boop"))
- end if
- else
- if totalTime < 2000 then
- if pCurrTimer <> 2 then
- showTimer(2)
- gWorld.deleteTexture("countdown3")
- pCurrTimer = 2
- sound(2).play(member("boop"))
- end if
- else
- if totalTime < 3000 then
- if pCurrTimer <> 1 then
- showTimer(1)
- gWorld.deleteTexture("countdown2")
- pCurrTimer = 1
- sound(2).play(member("boop"))
- end if
- else
- gCamera.removeOverlay(pCameraOverlay)
- gWorld.deleteTexture("countdown1")
- pCurrTimer = 0
- sound(2).play(member("beep"))
- go("Race")
- end if
- end if
- end if
- updateSky()
- go(the frame)
- end
-
- on showTimer theNum
- theTex = gWorld.newTexture("countdown" & theNum, #fromCastMember, member("countdown" & theNum))
- theTex.renderFormat = gTransFormat
- if voidp(pCameraOverlay) then
- pCameraOverlay = gCamera.overlay.count + 1
- gCamera.addOverlay(theTex, point(336, 186) * gSpriteScale, 0)
- gCamera.overlay[pCameraOverlay].scale = gSpriteScale
- else
- gCamera.overlay[pCameraOverlay].source = theTex
- end if
- end
-
- on prepareFrame me
- timeElapsed = the milliSeconds - pLastFrameTime
- repeat with i = 1 to gRacers.count
- gRacers[i].updateCarFloat()
- currMo = gRacers[i].pHavokCar.linearMomentum
- currMo.z = 0.0
- currVel = gRacers[i].pHavokCar.linearVelocity
- currVel.z = 0.0
- gRacers[i].pHavokCar.linearMomentum = currMo
- gRacers[i].pHavokCar.linearVelocity = currVel
- end repeat
- updateCamera()
- updateSpeedometer()
- pLastFrameTime = the milliSeconds
- end
-